<?php
echo '<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
	<title>Terenac news</title>
	<link>http://php.fer.hr/~mg44268/dz/dz5/index.php</link>
	<description>latest messages from users</description>
	<ttl>20</ttl>';

require 'MessageRepository.php';
require 'database.inc.php';

$messages = new MessageRepository();
$newMessages = $messages->getPage($db, 1);
foreach ($newMessages as $message) {
echo '<item>
	<title>'.$message['Comment'].'</title>
	<description>'.$message['PictureID'].'</description>
	<author>'.$message['Username'].'</author>
	<time>'.$message['Time'].'</time>
	<guid>'.$message['ID'].'</guid>
</item>';
}
 ?>
</channel>
</rss>
